/*
 * Copyright (C) 2011, EADS France
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */

package xowl.store.rdf;

/**
 *
 * @author Laurent WOUTERS
 */
public class RDFIRIReference implements RDFSubjectNode, RDFProperty {
    private RDFGraph.Key key;
    private xowl.lang.owl2.IRI iRI;

    public xowl.lang.owl2.IRI getIRI() { return iRI; }
    @Override public RDFNodeType getNodeType() { return RDFNodeType.IRIReference; }
    @Override public RDFGraph.Key _getKey() { return key; }
    @Override public RDFGraph.Literal _getLiteral() { return null; }
    @Override public int _getBlankID() { return 0; }
    @Override public xowl.lang.owl2.AnonymousIndividual _getAnon() { return null; }
    
    RDFIRIReference(RDFGraph.Key key, xowl.lang.owl2.IRI iri) {
        this.key = key;
        this.iRI = iri;
    }
    
    @Override public int hashCode() { return key.hashCode(); }
    @Override public boolean equals(Object obj) {
        if (obj instanceof RDFIRIReference)  {
            RDFIRIReference node = (RDFIRIReference)obj;
            return (key == node.key);
        }
        return false;
    }
    
    @Override public String toString() {
        return iRI.getHasValue();
    }
}
